package com.kfm.wiki.util;

import lombok.Data;

import java.io.Serializable;

@Data
public class R implements Serializable {

    private int code;

    private String message;

    private Object data;

    public R(int code, String message, Object data){
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static R ok(String message){
        return new R(200, message, null);
    }

    public static R ok(Object data){
        return new R(200, "请求成功", data);
    }

    public static R fail(String message){
        return new R(500, message, null);
    }

}
